package com.foruo.demo.spring.bean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

// 表示我是组件类，并通知spring创建bean
@Component
public class DemoEntity {

    private IToolEntity tool;

    private String name = "高元";
    private int age = 18;

    @Autowired
    public DemoEntity(IToolEntity tool){
        this.tool = tool;
    }

    public void show(){
        System.out.print("我是" + name + ",我今年"+ age +"岁，我在用" );
        tool.use();
    }

}
